<!doctype html>
<html>
<head>
    <meta charset=utf-8>
    <title></title>
    <meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<?=Web_Path?>packs/layui/css/layui.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/font.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/style.css">
    <script src="<?=Web_Path?>packs/js/jquery.min.js"></script>
    <script src="<?=Web_Path?>packs/layui/layui.js"></script>
    <script src="<?=Web_Path?>packs/admin/js/cscms.js"></script>
</head>
<body>
    <span class="layui-breadcrumb" >
        <a ><cite><i class="fa fa-map-marker"></i>位置</cite></a>
        <a href="<?=site_url('dance/admin/dance')?>">音乐</a>
        <a href="<?=site_url('dance/admin/topic')?>">歌曲专辑</a>
    </span>
    <div class="layui-tab layui-tab-brief" >
        <ul class="layui-tab-title">
            <li class="layui-this"><a class="tablink" href="<?=site_url('dance/admin/topic')?>">歌曲专辑列表</a></li>
            <li><a class="tablink" href="<?=site_url('dance/admin/topic/edit')?>">增加歌曲专辑</a></li>
        </ul>
        <div class="layui-tab-content" style="min-height: 360px;">
            <form class="layui-form layui-form-so" action="<?=site_url('dance/admin/topic')?>" method="post">
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <select name="zd">
                           <option value="name"<?php if($zd=='name') echo ' selected';?>>专辑名称</option>
                           <?php if($this->db->table_exists(CS_SqlPrefix.'singer')){ ?>
                           <option value="singer"<?php if($zd=='singer') echo ' selected';?>>歌手</option>
                           <?php } ?>
                           <option value="user"<?php if($zd=='user') echo ' selected';?>>录入会员</option>
                           <option value="tags"<?php if($zd=='tags') echo ' selected';?>>关键字</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="key" value="<?=$key?>" class="layui-input">
                    </div>
                    <div class="layui-input-inline">
                        <select name="yid">
                            <option value="0"<?php if($yid==0) echo ' selected';?>>状态</option>
                            <option value="1"<?php if($yid==1) echo ' selected';?>>正常</option>
                            <option value="2"<?php if($yid==2) echo ' selected';?>>锁定</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="tid">
                            <option value="0"<?php if($tid==0) echo ' selected';?>>是否推荐</option>
                            <option value="1"<?php if($tid==1) echo ' selected';?>>未推荐</option>
                            <option value="2"<?php if($tid==2) echo ' selected';?>>已推荐</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select class="select3" name="sort">
                            <option value=""<?php if($sort=='') echo ' selected';?>>专辑排序</option>
                            <option value="id"<?php if($sort=='id') echo ' selected';?>>ID编号</option>
                            <option value="addtime"<?php if($sort=='addtime') echo ' selected';?>>更新时间</option>
                            <option value="hits"<?php if($sort=='hits') echo ' selected';?>>总人气</option>
                            <option value="yhits"<?php if($sort=='yhits') echo ' selected';?>>月人气</option>
                            <option value="zhits"<?php if($sort=='zhits') echo ' selected';?>>周人气</option>
                            <option value="rhits"<?php if($sort=='rhits') echo ' selected';?>>日人气</option>
                        </select>
                    </div>
                     <div class="layui-input-inline">
                        <button class="layui-btn" type="submit">查询</button>
                    </div>
                </div>
            </form>
            <form class="layui-form" action="<?=site_url('dance/admin/topic/del')?>" method="post">
                <table class="layui-table">
                    <colgroup>
                        <col width="40">
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                        <tr>
                            <th>选</th>
                            <th class="phide minwidth20">ID</th>
                            <th class="phide minwidth30">图片</th>
                            <th>专辑名称</th>
                            <th class="phide minwidth30">歌手</th>
                            <th class="phide minwidth30">数量</th>
                            <th class="phide minwidth30">人气</th>
                            <th class="minwidth30">推荐</th>
                            <th class="minwidth30">状态</th>
                            <th class="phide minwidth80">更新时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php
                        if(empty($topic)) echo '<tr><td align="center" height="50" colspan="11">'.L('tpl_41').'</td></tr>';
                        foreach ($topic as $row) {
                            //歌曲数量
                            $numss=$this->db->query("SELECT id FROM ".CS_SqlPrefix."dance where tid=".$row->id."")->num_rows();
                            $pic=!empty($row->pic)?'<img height="30" src="'.piclink('dancetopic',$row->pic).'">':'-';
                            //状态
                            $zt=($row->yid==0)?'<a title="点击锁定" href="javascript:cscms.ok_no(\''.site_url('dance/admin/topic/init/zt').'\','.$row->id.',0,\'zt_\');"><i class="fa fa-check colorl"></i></a>':'<a title="点击解除锁定" href="javascript:cscms.ok_no(\''.site_url('dance/admin/topic/init/zt').'\','.$row->id.',1,\'zt_\');"><i class="fa fa-close colorr"></i></a>';
                            //推荐状态
                            $tj=($row->tid==1)?'<a title="点击取消推荐" href="javascript:cscms.ok_no(\''.site_url('dance/admin/topic/init/tj').'\','.$row->id.',1,\'tj_\');"><i class="fa fa-check colorl"></i></a>':'<a title="点击推荐" href="javascript:cscms.ok_no(\''.site_url('dance/admin/topic/init/tj').'\','.$row->id.',0,\'tj_\');"><i class="fa fa-close colorr"></i></a>';
                            //时间加亮
                            if(date('Y-m-d',$row->addtime)==date('Y-m-d')){
                                 $addtime='<font color=red>'.date('Y-m-d',$row->addtime).'</font>';
                            }else{
                                 $addtime=date('Y-m-d',$row->addtime);
                            }
                            //歌手
                            $singer='-';
                            if($this->db->table_exists(CS_SqlPrefix.'singer')){  //歌手表存在
                                 $singer=getzd('singer','name',$row->singerid);
                                 if($singer!='null'){
                                     $singer='<a href="'.linkurl('show','',$row->singerid,1,'singer').'" target="singer">'.$singer.'</a>';
                                 }
                            }
                            echo '
                                <tr id="row_'.$row->id.'">
                                <td><input class="xuan" name="id['.$row->id.']" type="checkbox" value="'.$row->id.'" /></td>
                                <td class="phide">'.$row->id.'</td>
                                <td class="phide">'.$pic.'</td>
                                <td><a class="colorl" href="'.linkurl('topic','show',$row->id,1,'dance').'" target="web">'.$row->name.'</a></td>
                                <td class="phide">'.$singer.'</td>
                                <td class="phide">'.$numss.'</td>
                                <td class="phide">'.$row->hits.'</td>
                                <td id="tj_'.$row->id.'" style="max-width: 60px;text-align: center;">'.$tj.'</td>
                                <td id="zt_'.$row->id.'" style="max-width: 60px;text-align: center;">'.$zt.'</td>
                                <td class="phide">'.$addtime.'</td>
                                <td class="basedb-more">
                                    <a class="layui-btn layui-btn-mini" href="'.site_url('dance/admin/topic/edit').'?id='.$row->id.'">修改</a>
                                    <a class="layui-btn layui-btn-mini layui-btn-danger" href="javascript:cscms.del_one(\''.site_url('dance/admin/topic/del').'\','.$row->id.');">删除</a>
                                </td>
                            </tr> ';
                        }
                        ?>
                    </tbody>
                </table>
                <div class="more_func">
                    <a class="layui-btn layui-btn-primary layui-btn-small" href="javascript:cscms.select_all();"><i class="fa fa-check colorl" ></i>全选/反选</a>
                    <a class="layui-btn layui-btn-primary layui-btn-small" lay-submit lay-filter="del_pl"><i class="fa fa-close " style="color: red" ></i>删除选中</a>
                    <a class="layui-btn layui-btn-primary layui-btn-small" href="<?=site_url('dance/admin/topic/edit')?>"><i class="fa fa-plus colorn"></i>新增专辑</a>
                </div>
            </form>
            <div id="page">
                <div class="data_nums phide"><?=$page_data?></div>
                <div class="data_page"><?=$page_list?></div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        cscms.init();
    </script>
</body>
</html>